package com.gexiaobao.pigeon.ui.fragment.mine.tools

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.gexiaobao.pigeon.app.base.BaseFragment
import com.gexiaobao.pigeon.app.ext.initClose
import com.gexiaobao.pigeon.databinding.FragmentMinuteSpeedBinding
import com.gexiaobao.pigeon.ui.adapter.MyPagerAdapter
import com.gexiaobao.pigeon.viewmodel.MinuteSpeedViewModel
import me.hgj.jetpackmvvm.ext.nav

/**
 * @Author      : hxw
 * @Date        : 2023/5/31 15:31
 * @Describe    : 分速计算
 */
class FragmentMinuteSpeed : BaseFragment<MinuteSpeedViewModel, FragmentMinuteSpeedBinding>() {

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.includeBar.toolbar.initClose("分速时间") {
            nav().navigateUp()
        }

        val fragmentList = ArrayList<Fragment>()
        val titleList = ArrayList<String>()
        fragmentList.add(FragmentCalculate.newInstance())
        fragmentList.add(FragmentRule.newInstance())
        titleList.add("计算")
        titleList.add("规则")
        mDatabind.viewPager.adapter =
            context?.let { MyPagerAdapter(childFragmentManager, it, fragmentList, titleList) }
        mDatabind.viewPager.offscreenPageLimit = 2
        mDatabind.tabLayout.setupWithViewPager(mDatabind.viewPager)
    }
}